import streamlit as st

def form_app():
    # 设置两列布局
    with st.columns(2):
        # 左列
        col1, col2 = st.columns(2)
        with col1:
            # 在左列中添加表单元素
            name = st.text_input("姓名:")
        with col2:
            # 在右列中添加表单元素
            age = st.number_input("年龄:")

            # 可以继续添加更多表单元素
        with col1:
            email = st.text_input("邮箱:")
        with col2:
            password = st.text_input("密码:", type='password')

            # 提交按钮
        submit_button = st.form_submit_button(label="提交")

        # 检查是否提交了表单
    if submit_button:
        # 处理表单数据
        st.write(f"姓名: {name}")
        st.write(f"年龄: {age}")
        st.write(f"邮箱: {email}")
        st.write(f"密码: {password}")

    # 运行 Streamlit 应用
if __name__ == "__main__":
    form_app()